#include "HandleListWidget.h"
#include<QStringList>
HandleListWidget::HandleListWidget()
{

}
//bool HandleListWidget::deleteSelectItem(QListWidget *mHandleListWidget,QMap<QListWidgetItem *,MdlInfo *> *MdlInfoMap){
//    int rowsCount = mHandleListWidget->count();
//    QStringList ItemsList;
//    for(int i=0;i<rowsCount;i++){
//        ItemsList.append(mHandleListWidget->item(i)->text());
//    }
//    QList<QListWidgetItem *> SelectItems = mHandleListWidget->selectedItems();
//    for(int i=0;i<SelectItems.size();i++){
//        for(int j=0;j<ItemsList.size();j++){
//          if(SelectItems.at(i)->text()==ItemsList.at(j)){
//              ItemsList.removeAt(j);
//              MdlInfoMap->remove(SelectItems.at(i));
//              break;
//          }
//        }
//    }
//    mHandleListWidget->clear();
//    mHandleListWidget->addItems(ItemsList);
//    return true;
//}

bool HandleListWidget::deleteSelectItem(QListWidget *mHandleListWidget,QMap<QListWidgetItem *,MdlInfo *> *MdlInfoMap){
    QList<QListWidgetItem *> SelectItems = mHandleListWidget->selectedItems();
    for(int i=0;i<SelectItems.size();i++){
              mHandleListWidget->removeItemWidget(SelectItems.at(i));
              MdlInfoMap->remove(SelectItems.at(i));
              delete(SelectItems.at(i));
    }
    return true;
}

bool HandleListWidget::ClearItem(QListWidget *mHandleListWidget, QMap<QListWidgetItem *,MdlInfo *> *MdlInfoMap){
    mHandleListWidget->clear();
    MdlInfoMap->clear();
    return true;
}
